package com.transaction.simulate.mapper;

import com.transaction.common.base.User;
import com.transaction.simulate.model.dto.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {

    @Insert("insert into t_user (userCode,accountName,passWord,userName,salt) " +
            "values (#{userCode},#{accountName},#{passWord},#{userName},#{salt})")
    int addUser(User user);

    @Select("select * from t_user t where t.accountName = #{accountName}")
    User getUserByAccountName(String accountName);

    @Select("select * from t_role t ")
    List<Role> getRoles();

    @Delete("delete from t_userRole where roleCode = #{roleCode}")
    void deleteUserRoleBuRoleCode(String roleCode);
}
